package org.darkforest.model;

import org.darkforest.common.util.Page;
import org.darkforest.enums.ProxyApplyStageEnum;

import java.util.Date;

public class Proxy extends Page<Proxy> {
    private Integer proxyId;

    private Integer proxyLevel;

    private Integer memberProxyRel;

    private String applyMemberName; //申请代理人名称

    private String contactName;

    private String contactPhone;

    private String contactEmail;

    private Date approveDate;

    private Integer approveResult;

    private String approver;

    private Date applyDate;

    private Integer teamId;             //团队id

    private Date levelUpgradeTime;

    private String teamName;            //团队名称

    private Integer applyStage;          //申请阶段

    private Integer parentProxy;        //上一级代理商编号

    private String avatar;              //子级代理商相关信息字段
    private String memberTruename;
    private Integer memberCnt;          //下级会员数量
    private Integer proxyCnt;           //下级代理商数量

    public Proxy(Integer proxyId) {
        this.proxyId = proxyId;
    }

    public Proxy() {

    }

    public Proxy(Integer memberId,String memberName){
        this.memberProxyRel = memberId;
        this.applyMemberName = memberName;
    }

    public String getApplyProxyLevelDes() {
        switch (proxyLevel) {
            case 1:
                return "一级代理商";
            case 2:
                return "二级代理商";
            case 3:
                return "三级代理商";
            default:
                return "未知";
        }
    }

    public String getApproveResultDes() {
        switch (approveResult) {
            case 0:
                return "新申请";
            case 1:
                return "已通过";
            case 2:
                return "未通过";
            default:
                return "未知";
        }
    }


    public Date getApplyDate() {
        return applyDate;
    }

    public void setApplyDate(Date applyDate) {
        this.applyDate = applyDate;
    }

    public Date getApproveDate() {
        return approveDate;
    }

    public void setApproveDate(Date approveDate) {
        this.approveDate = approveDate;
    }

    public Integer getApproveResult() {
        return approveResult;
    }

    public void setApproveResult(Integer approveResult) {
        this.approveResult = approveResult;
    }

    public String getApprover() {
        return approver;
    }

    public void setApprover(String approver) {
        this.approver = approver == null ? null : approver.trim();
    }


    public Integer getProxyId() {
        return proxyId;
    }

    public void setProxyId(Integer proxyId) {
        this.proxyId = proxyId;
    }

    public Integer getProxyLevel() {
        return proxyLevel;
    }

    public void setProxyLevel(Integer proxyLevel) {
        this.proxyLevel = proxyLevel;
    }


    public Integer getMemberProxyRel() {
        return memberProxyRel;
    }

    public void setMemberProxyRel(Integer memberProxyRel) {
        this.memberProxyRel = memberProxyRel == null ? null : memberProxyRel;
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName == null ? null : contactName.trim();
    }

    public String getContactPhone() {
        return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone == null ? null : contactPhone.trim();
    }

    public String getContactEmail() {
        return contactEmail;
    }

    public void setContactEmail(String contactEmail) {
        this.contactEmail = contactEmail;
    }

    public String getApplyMemberName() {
        return applyMemberName;
    }

    public void setApplyMemberName(String applyMemberName) {
        this.applyMemberName = applyMemberName;
    }

    public Date getLevelUpgradeTime() {
        return levelUpgradeTime;
    }

    public void setLevelUpgradeTime(Date levelUpgradeTime) {
        this.levelUpgradeTime = levelUpgradeTime;
    }

    public Integer getTeamId() {
        return teamId;
    }

    public void setTeamId(Integer teamId) {
        this.teamId = teamId;
    }

    public String getTeamName() {
        return teamName;
    }

    public void setTeamName(String teamName) {
        this.teamName = teamName;
    }

    public Integer getApplyStage() {
        return applyStage;
    }

    public void setApplyStage(Integer applyStage) {
        this.applyStage = applyStage;
    }

    public void setApplyStage(ProxyApplyStageEnum applyStageEnum){
        this.applyStage = applyStageEnum.getStage();
    }

    public String getAvatar() {
        if(avatar!=null && "/0".equals(avatar.substring(avatar.length() - 2, avatar.length()))){
            avatar = avatar.substring(0,avatar.length()-2);
        }

        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getMemberTruename() {
        return memberTruename;
    }

    public void setMemberTruename(String memberTruename) {
        this.memberTruename = memberTruename;
    }

    public Integer getMemberCnt() {
        return memberCnt;
    }

    public void setMemberCnt(Integer memberCnt) {
        this.memberCnt = memberCnt;
    }

    public Integer getProxyCnt() {
        return proxyCnt;
    }

    public void setProxyCnt(Integer proxyCnt) {
        this.proxyCnt = proxyCnt;
    }

    public Integer getParentProxy() {
        return parentProxy;
    }

    public void setParentProxy(Integer parentProxy) {
        this.parentProxy = parentProxy;
    }
}